package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConTouristProblemFeedback;
import com.htgd.gardenexpo.dao.GeConTouristProblemFeedbackDao;
import com.htgd.gardenexpo.service.GeConTouristProblemFeedbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConTouristProblemFeedback)表服务实现类
 *
 * @author makejava
 * @since 2021-06-09 15:43:39
 */
@Service("geConTouristProblemFeedbackService")
public class GeConTouristProblemFeedbackServiceImpl implements GeConTouristProblemFeedbackService {
    @Resource
    private GeConTouristProblemFeedbackDao geConTouristProblemFeedbackDao;

    /**
     * 通过ID查询单条数据
     *
     * @param 主键
     * @return 实例对象
     */
    @Override
    public GeConTouristProblemFeedback queryById() {
        return this.geConTouristProblemFeedbackDao.queryById();
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConTouristProblemFeedback> queryAllByLimit(int offset, int limit) {
        return this.geConTouristProblemFeedbackDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConTouristProblemFeedback> getinfoByProblemId(int id) {
        return this.geConTouristProblemFeedbackDao.getinfoByProblemId(id);
    }

    /**
     * 新增数据
     *
     * @param geConTouristProblemFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConTouristProblemFeedback insert(GeConTouristProblemFeedback geConTouristProblemFeedback) {
        this.geConTouristProblemFeedbackDao.insert(geConTouristProblemFeedback);
        return geConTouristProblemFeedback;
    }

    /**
     * 修改数据
     *
     * @param geConTouristProblemFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConTouristProblemFeedback update(GeConTouristProblemFeedback geConTouristProblemFeedback) {
        this.geConTouristProblemFeedbackDao.update(geConTouristProblemFeedback);
        return this.queryById();
    }

    /**
     * 通过主键删除数据
     *
     * @param 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById() {
        return this.geConTouristProblemFeedbackDao.deleteById() > 0;
    }

    @Override
    public boolean deleteByProblemId(int id) {
        return this.geConTouristProblemFeedbackDao.deleteByProblemId(id) > 0;
    }
}
